#!/bin/bash
geturl="http://rayangscripts.googlecode.com/files/ehcache_stats"
ifneed_update=`grep "/usr/local/bin/ehcache_stats"|wc -l`
if [ -f /etc/snmp/snmpd ] && [ -eq 0 ];then
cat >> /etc/snmp/snmpd.conf << EOF
extend .1.3.6.1.4.1.2021.2013 diskCount /usr/local/bin/ehcache_stats diskCount
extend .1.3.6.1.4.1.2021.2014 evicted /usr/local/bin/ehcache_stats evicted
extend .1.3.6.1.4.1.2021.2015 expired /usr/local/bin/ehcache_stats expired
extend .1.3.6.1.4.1.2021.2016 hit /usr/local/bin/ehcache_stats hit
extend .1.3.6.1.4.1.2021.2017 hitDisk /usr/local/bin/ehcache_stats hitDisk
extend .1.3.6.1.4.1.2021.2018 hitMemory /usr/local/bin/ehcache_stats hitMemory
extend .1.3.6.1.4.1.2021.2019 hitOffHeap /usr/local/bin/ehcache_stats hitOffHeap
extend .1.3.6.1.4.1.2021.2020 hitRatio /usr/local/bin/ehcache_stats hitRatio
extend .1.3.6.1.4.1.2021.2021 memoryCount /usr/local/bin/ehcache_stats memoryCount
extend .1.3.6.1.4.1.2021.2022 memorySize /usr/local/bin/ehcache_stats memorySize
extend .1.3.6.1.4.1.2021.2023 miss /usr/local/bin/ehcache_stats miss
extend .1.3.6.1.4.1.2021.2024 missDisk /usr/local/bin/ehcache_stats missDisk
extend .1.3.6.1.4.1.2021.2025 missMemory /usr/local/bin/ehcache_stats missMemory
extend .1.3.6.1.4.1.2021.2026 missOffHeap /usr/local/bin/ehcache_stats missOffHeap
extend .1.3.6.1.4.1.2021.2027 offHeapCount /usr/local/bin/ehcache_stats offHeapCount
extend .1.3.6.1.4.1.2021.2028 offHeapSize /usr/local/bin/ehcache_stats offHeapSize
extend .1.3.6.1.4.1.2021.2029 offHeapUsage /usr/local/bin/ehcache_stats offHeapUsage
extend .1.3.6.1.4.1.2021.2030 offHeapUsed /usr/local/bin/ehcache_stats offHeapUsed
extend .1.3.6.1.4.1.2021.2031 put /usr/local/bin/ehcache_stats put
extend .1.3.6.1.4.1.2021.2032 removed /usr/local/bin/ehcache_stats removed
extend .1.3.6.1.4.1.2021.2033 totalCount /usr/local/bin/ehcache_stats totalCount
extend .1.3.6.1.4.1.2021.2034 updated /usr/local/bin/ehcache_stats updated
EOF
wget ${geturl} -O /usr/local/bin/ehcache_stats
chmod 0755 /usr/local/bin/ehcache_stats
/etc/init.d/snmpd restart